package mya.mes.mdc.model.alarm;

import mya.mes.mdc.model.plc.PlcTagDef;
import mya.mes.mdc.model.plc.PlcTagType;
import org.eclipse.persistence.annotations.Cache;

import javax.persistence.*;


/**
 * prefix: AI = 1, DI = 2, ST = 3 <br>
 * objectId = prefix+  tagIndex（4位）  + bitIndex（2位）
 */
@Entity
@Cacheable
@Cache(size = 2000)
@Table(name = "MDC_ALARM_TYPE", indexes = {
        @Index(name = "TAG_IDNEX", columnList = "MDC_TAG ASC"),
        @Index(name = "TAG_BIT_IDNEX", columnList = "MDC_TAG ASC,BIT_INDEX ASC"),
})
public class MdcAlarmType extends PlcTagDef {

    @Transient
    private final PlcTagType plcTagType = PlcTagType.ALARM;

    /**
     * 等待时间(毫秒）之后，才发送到责任人
     */
    public Long timeWaitToPerson;
    /**
     * 等待时间(毫秒）之后，才发送到管理人员
     */
    public Long timeWaitToManager;

    /**
     * 是否需要发送到责任人
     */
    public Boolean needSendToPerson = false;

    /**
     * 已经发送到管理人员
     */
    public Boolean needSendToManager = false;


    /**
     * 微信公众号用户标签
     */
    public String wxPersonTag;

    /**
     * 微信公众号管理人员用户标签
     */
    public String wxManagerTag;


    public String getTagPrefix() {
        return tagPrefix;
    }

    public void setTagPrefix(String tagPrefix) {
        this.tagPrefix = tagPrefix;
    }

    public Integer getTagIndex() {
        return tagIndex;
    }

    public void setTagIndex(Integer tagIndex) {
        this.tagIndex = tagIndex;
    }

    public String getMdcTag() {
        return mdcTag;

    }

    public void setMdcTag(String mdcTag) {
        this.mdcTag = mdcTag;
    }

    public Integer getBitIndex() {
        return bitIndex;
    }

    public void setBitIndex(Integer bitIndex) {
        this.bitIndex = bitIndex;
    }

    public Long getTimeWaitToPerson() {
        return timeWaitToPerson;
    }

    public void setTimeWaitToPerson(Long timeWaitToPerson) {
        this.timeWaitToPerson = timeWaitToPerson;
    }

    public Long getTimeWaitToManager() {
        return timeWaitToManager;
    }

    public void setTimeWaitToManager(Long timeWaitToManager) {
        this.timeWaitToManager = timeWaitToManager;
    }

    public Boolean getNeedSendToPerson() {
        return needSendToPerson;
    }

    public void setNeedSendToPerson(Boolean needSendToPerson) {
        this.needSendToPerson = needSendToPerson;
    }

    public Boolean getNeedSendToManager() {
        return needSendToManager;
    }

    public void setNeedSendToManager(Boolean needSendToManager) {
        this.needSendToManager = needSendToManager;
    }

    public String getWxPersonTag() {
        return wxPersonTag;
    }

    public void setWxPersonTag(String wxPersonTag) {
        this.wxPersonTag = wxPersonTag;
    }

    public String getWxManagerTag() {
        return wxManagerTag;
    }

    public void setWxManagerTag(String wxManagerTag) {
        this.wxManagerTag = wxManagerTag;
    }

    @Transient
    @Override
    public PlcTagType getPlcTagType() {
        return plcTagType;
    }
}
